<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>elFinder 2.1.x source version with PHP connector</title>
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2" />
		<link rel="stylesheet" type="text/css" href="jquery/jquery-ui.min.css">
		<link rel="stylesheet" type="text/css" href="elfinder/2.1.11/css/elfinder.min.css">
		<link rel="stylesheet" type="text/css" href="elfinder/2.1.11/css/theme.css">		
	</head>
	<body>

		<div id="elfinder"></div>
		
		<script src="jquery/jquery.min.js"></script>
		<script src="jquery/jquery-ui.min.js"></script>
		<script src="elfinder/2.1.11/js/elfinder.min.js"></script>
		<script src="elfinder/2.1.11/js/i18n/elfinder.zh_CN.js"></script>
		<script type="text/javascript" charset="utf-8">
			$(document).ready(function() {
				/*
				$('#elfinder').elfinder({
					url : 'web/connector'
				});
				*/
				
				var funcNum = getUrlParam('CKEditorFuncNum');
				console.log('funcNum='+funcNum);

				var elf = $('#elfinder').elfinder({
					url : 'web/flconnector',
					getFileCallback : function(file) {
						window.opener.CKEDITOR.tools.callFunction(funcNum, file.url);
						elf.destroy();
						window.close();
					},
					resizable: false
				}).elfinder('instance');
			});
			
			function getUrlParam(paramName) {
				var reParam = new RegExp('(?:[\?&]|&amp;)' + paramName + '=([^&]+)', 'i') ;
				var match = window.location.search.match(reParam) ;

				return (match && match.length > 1) ? match[1] : '' ;
			}
		</script>
	</body>
</html>
